package com.thinkgem.jeesite.modules.app.service;

import com.thinkgem.jeesite.modules.app.entity.ANeighborhood;
import com.thinkgem.jeesite.modules.cms.dao.ArticleDataDao;
import com.thinkgem.jeesite.modules.cms.dao.ClassifiedInfoDataDao;
import com.thinkgem.jeesite.modules.cms.entity.ArticleData;
import com.thinkgem.jeesite.modules.cms.entity.ClassifiedInfoData;
import com.thinkgem.jeesite.modules.sys.dao.OfficeDao;
import com.thinkgem.jeesite.modules.sys.dao.UserDao;
import com.thinkgem.jeesite.modules.sys.entity.Office;
import com.thinkgem.jeesite.modules.sys.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by xiaguoqiang on 16/5/31.
 */
@Service
@Transactional(readOnly = false)
public class CommunityService {

    @Autowired
    private ArticleDataDao articleDataDao;

    @Autowired
    private OfficeDao officeDao;

    @Autowired
    private UserDao userDao;

    @Autowired
    private ClassifiedInfoDataDao classifiedInfoDataDao;

    public ArticleData findArticleContentById(String id){ return articleDataDao.get(id); }

    public ClassifiedInfoData findClassContentById( String id){ return classifiedInfoDataDao.get(id); }

    public List<ANeighborhood> getAllNeighborhood(Office office){ return officeDao.getAllNeighborhood(office); }

    public List<Office> getAllCommunity(Office office){
        return officeDao.getAllCommunity(office);
    }

    public void updateMobileInfo(User user){
        user.preUpdate();
        userDao.updateMobileInfo(user);
    }

}
